package com.sun.customer.manager;

import com.sun.customer.mapper.local.LocalRoleBaseDOMapper;
import com.sun.customer.mapper.local.LocalUserBaseDOMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by yingsy on 2021-03-16.
 */
@Component
public class LocalManager {

    @Autowired
    private LocalRoleBaseDOMapper localRoleBaseDOMapper;
    @Autowired
    private LocalUserBaseDOMapper localUserBaseDOMapper;

    @Transactional(propagation = Propagation.REQUIRED)
    public void updateRoleNameById(Integer num, String name){
        localRoleBaseDOMapper.updateNameById(name);
    }

    @Transactional(propagation = Propagation.REQUIRED)
    public void updateUserNameById(Integer num, String name){
        localUserBaseDOMapper.updateNameById(name);
    }

    @Transactional(propagation = Propagation.REQUIRES_NEW)
    public void updateRoleNameById3(Integer num, String name){
        localRoleBaseDOMapper.updateNameById(name);
    }

    @Transactional(propagation = Propagation.REQUIRED)
    public void updateUserNameById3(Integer num, String name){
        localUserBaseDOMapper.updateNameById(name);
    }
}
